Skip to content

dns: stop using deprecated functions in SetServers#64356

Open
aduh95 wants to merge 1 commit into
nodejs:mainfrom
aduh95:dns-c-ares-set-servers
Open

dns: stop using deprecated functions in SetServers#64356
aduh95 wants to merge 1 commit into
nodejs:mainfrom
aduh95:dns-c-ares-set-servers

Conversation

@aduh95

@aduh95 aduh95 commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Fixes the following warnings:

../../src/cares_wrap.cc:2047:11: warning: 'ares_get_servers_ports' is deprecated: Use ares_get_servers_csv instead [-Wdeprecated-declarations]
 2047 |   int r = ares_get_servers_ports(channel->cares_channel(), &servers);
      |           ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1187:1: note: 'ares_get_servers_ports' has been explicitly marked deprecated here
 1187 | CARES_DEPRECATED_FOR(ares_get_servers_csv)
      | ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
../../src/cares_wrap.cc:2092:14: warning: 'ares_set_servers' is deprecated: Use ares_set_servers_csv instead [-Wdeprecated-declarations]
 2092 |     int rv = ares_set_servers(channel->cares_channel(), nullptr);
      |              ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1168:14: note: 'ares_set_servers' has been explicitly marked deprecated here
 1168 | CARES_EXTERN CARES_DEPRECATED_FOR(ares_set_servers_csv) int ares_set_servers(
      |              ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^
../../src/cares_wrap.cc:2152:11: warning: 'ares_set_servers_ports' is deprecated: Use ares_set_servers_ports_csv instead [-Wdeprecated-declarations]
 2152 |     err = ares_set_servers_ports(channel->cares_channel(), servers.data());
      |           ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:1172:1: note: 'ares_set_servers_ports' has been explicitly marked deprecated here
 1172 | CARES_DEPRECATED_FOR(ares_set_servers_ports_csv)
      | ^
/nix/store/655p6if1xf6r88nnr876x7xmclflyx2z-c-ares-1.34.7-dev/include/ares.h:153:22: note: expanded from macro 'CARES_DEPRECATED_FOR'
  153 |       __attribute__((deprecated("Use " #f " instead")))
      |                      ^

See https://c-ares.org/docs/ares_set_servers.html#Notes:

Deprecated functions as of c-ares 1.24.0 due to inability to set all available server options. Use ares_set_servers_csv.

The required test change indicates this is a breaking change, I've tried working around it but couldn't find a way

Signed-off-by: Antoine du Hamel <duhamelantoine1995@gmail.com>
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/net

@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. needs-ci PRs that need a full CI run. labels Jul 8, 2026
@richardlau

Copy link
Copy Markdown
Member

The required test change indicates this is a breaking change, I've tried working around it but couldn't find a way

This is semver-major then?

@codecov

codecov Bot commented Jul 8, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.25%. Comparing base (1d87a24) to head (087a74e).
⚠️ Report is 56 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #64356   +/-   ##
=======================================
  Coverage   90.25%   90.25%           
=======================================
  Files         741      741           
  Lines      240990   240979   -11     
  Branches    45402    45404    +2     
=======================================
- Hits       217502   217500    -2     
+ Misses      15066    15061    -5     
+ Partials     8422     8418    -4     
Files with missing lines Coverage Δ
src/cares_wrap.cc 61.63% <100.00%> (-0.02%) ⬇️

... and 32 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aduh95 aduh95 added the semver-major PRs that contain breaking changes and should be released in the next major version. label Jul 8, 2026

@mcollina mcollina left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina added commit-queue Add this label to land a pull request using GitHub Actions. request-ci Add this label to start a Jenkins CI on a PR. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Jul 13, 2026
@github-actions github-actions Bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Jul 13, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. cares Issues and PRs related to the c-ares dependency or the cares_wrap binding. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants